%------------------------------------------------------------------
%------------------------------------------------------------------
%   Author: Md. Sazzad Hussain (sazzad.hussain@sydney.edu.au)
%   Learning and Affect Technologies Engineering (LATTE)
%   University of Sydney, 2012
%------------------------------------------------------------------
%------------------------------------------------------------------

% %Siento Top Module (Main)
clc;
clear all;
%% Toolbox Set
% % Define the paths for library and codes

% rehash toolbox; 
% clear classes;

%-----Mac---------
codePath='/My_Drive/Drive1/USYD_Research/sazzadPhD_SVN/myFramework/siento_edr';
libPath='/My_Drive/Drive1/USYD_Research/sazzadPhD_SVN/myLib';

%-----Winhows-----
% codePath='D:\USYD_Research\sazzadPhD_SVN\myFramework\siento_edr';
% libPath='D:\USYD_Research\sazzadPhD_SVN\myLib';

myCodes = genpath(codePath);
myLib = genpath(libPath);
addpath(myCodes);%framework path
addpath(myLib);%library path

%define OS
opSys=1; % 1-Mac; 2-Windows
%% files I/O
% %location for input and output files
%dir for input/output files

if opSys==1
    %-----Mac---------
    indir='/My_Drive/Drive1/USYD_Research/Misc Folders/Dataset/NICTA Experiment 2010/NICTA_Exp1_Physio MAT Files';
    outdir='/My_Drive/Drive1/USYD_Research/Research Data/EDR/raw_edResp/Cognitive';    
elseif opSys==2
    %-----Windows-----
%     indir='';
%     outdir='';
end
%% subject IDs
%subject ID from experiment

subjectID=[
% 'siento_iaps_sub1_2010-09-06'         %AT
% 'siento_iaps_sub1_2010-09-07'     %bad GSR
% 'siento_iaps_sub1_2010-09-08'       %iaps only (rejected AT)
% 'siento_iaps_sub1_2010-09-13'       %bad EMG
% 'siento_iaps_sub1_2010-09-14'         %AT
% 'siento_iaps_sub1_2010-09-15'         %AT
% 'siento_iaps_sub2_2010-09-15'         %iaps only 
% 'siento_iaps_sub1_2010-09-16'         %AT
% 'siento_iaps_sub2_2010-09-16'         %AT
% 'siento_iaps_sub1_2010-09-17'         %AT
% 'siento_iaps_sub1_2010-09-20'         %AT
% 'siento_iaps_sub2_2010-09-20'         %AT
% 'siento_iaps_sub1_2010-09-21'         %AT (not used for mapping)
% 'siento_iaps_sub1_2010-09-23'         %AT
% 'siento_iaps_sub2_2010-09-23'         %AT%%%resp crash after 104
% 'siento_iaps_sub1_2010-09-24'         %AT
% 'siento_iaps_sub1_2010-09-29'         %AT
% 'siento_iaps_sub1_2010-09-30'         %AT
% 'siento_iaps_sub2_2010-09-30'         %AT
% 'siento_iaps_sub1_2010-10-13'         %AT  
% 
'nicta1_sub1_2010-11-08'
'nicta1_sub1_2010-11-09'
'nicta1_sub1_2010-11-10'%eyefeat
'nicta1_sub1_2010-11-11'%eyefeat
'nicta1_sub1_2010-11-12'%eyefeat
'nicta1_sub1_2010-11-15'%eyefeat
'nicta1_sub1_2010-11-16'%eyefeat
'nicta1_sub2_2010-11-08'%eyefeat
'nicta1_sub2_2010-11-09'%eyefeat
'nicta1_sub2_2010-11-10'%eyefeat, vid started late
'nicta1_sub2_2010-11-11'%eyefeat
'nicta1_sub2_2010-11-12'%eyefeat
'nicta1_sub2_2010-11-15'%eyefeat, physio started late
'nicta1_sub2_2010-11-16'%eyefeat
'nicta1_sub3_2010-11-08'%eyefeat
'nicta1_sub3_2010-11-09'%eyefeat
'nicta1_sub3_2010-11-10'
'nicta1_sub3_2010-11-15'
'nicta1_sub3_2010-11-16'%no video
'nicta1_sub4_2010-11-16'%eyefeat
];

%% configure physio/channels
% % Define the window sizes of channels for feature extraction

% window size, sampling rate, downsample size
startTime=0; %start of window (sec), 0-file TS;
winSizeECG=12;  %ECG
winSizeResp=12; %RESP
sRate=1000; %original sample rate
dSample=5;  %downsample; 1-no ds
%% feature extraction from IAPS
% % ECG, Rsp feature extraction using AuBT (subjectID)

% dubug=0;%1-show physio raw in plot, 0-off
% featExt1=iapsFeatEx_edr(subjectID,indir,startTime,winSizeECG,winSizeResp,sRate,dSample,outdir,dubug,opSys);
% if featExt1==1 
%     disp('Feat Ext COMPLETE (IAPS)');
% end

%note: check aubtProxy

%% feature extraction from IAPS-congnitiveLoad

dubug=0;%1-show physio raw in plot, 0-off
featExt3=EmoCogFeatEx_edr(subjectID,indir,startTime,winSizeECG, winSizeResp,sRate,dSample,outdir,dubug,opSys);
if featExt3==1 
    disp('Feat Ext COMPLETE (EmoCog)');
end

%note: check aubtProxy

%% Toolbox clear
rmpath(myCodes);
rmpath(myLib);